package com.jzfai.controller;

import com.jzfai.entity.Access;
import com.jzfai.service.AccessService;
import com.jzfai.utils.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title: AccessController
 * @Description:
 * @Auther:kuanghua
 * @Version: 1.0
 * @create 2019/8/16 17:44
 */
@RestController
@RequestMapping("access")
public class AccessController {
    @Autowired
    AccessService accessService;

    @PostMapping("getListAccess")
    public JsonData getListAccess(@RequestBody Access access) {
        access.setPageNum((access.getPageNum() - 1) * access.getPageSize());
        return accessService.getListAccess(access);
    }
    @PostMapping("addAccess")
    public JsonData addAccess(@RequestBody Access access){
        return accessService.addAccess(access);
    }
    @PostMapping("editAccess")
    public JsonData editAccess(@RequestBody Access access){
        return accessService.editAccess(access);
    }
    @PostMapping("deleteAccess")
    public JsonData deleteAccess(Integer id){
        return accessService.deleteAccess(id);
    }
}
